<%@page import="fr.uniscol.model.BaseAnneeScolaire"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

<h3>${classe.libelle}</h3>

<div class="container-fluid">
    <div class="row">
        <form:form name="frmClasse" action="classe.save" method="post" class="form-horizontal" role="form" modelAttribute="classe">
            <form:input path="id" type="hidden" name="id" value="${classe.id}" />

            <div class="form-group">
                <label class="col-sm-2 control-label" for="nom">Libellé</label>
                <div class="col-sm-2">
                    <form:input path="libelle" placeholder="Libellé" required="true" class="form-control" value="${classe.libelle}"/>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 control-label" for="prenom">Structure (SIECLE)</label>
                <div class="col-sm-2">
                    <form:input path="codeStructure" placeholder="Code Structure" required="true" class="form-control" value="${classe.codeStructure}"/>
                </div>
            </div>

            <div class="col-sm-offset-8 col-sm-2 form-group">
                <form:button type="submit" class="btn btn-primary btn-md">Enregistrer</form:button>
            </div>

        </form:form>
    </div>
	<div class="row">
		<div class="col-sm-8">
            
			<table class="table table-hover">
				<thead>
					<tr>
						<th>Nom</th>
						<th>Prénom</th>
						<th>INE</th>
						<th></th>
					</tr>
				</thead>
				<tbody>
				<c:forEach items="${classe.eleves}" var="eleve">
					<tr>
						<td><a href="<c:url value="eleve.edit?eleveId=${eleve.id}" />">${eleve.nom}</a></td>
						<td>${eleve.prenom}</td>
						<td>${eleve.ine}</td>
						<td class="buttons">
						</td>
					</tr>
				</c:forEach>
				</tbody>
			</table>
            <c:if test="${empty classe.eleves}">
                 <div class="alert alert-warning"><span class="glyphicon glyphicon-warning-sign"></span>&nbsp;Aucun élève dans la classe</div>
            </c:if>
		</div>
	</div>
</div>